﻿using System;
using Newtonsoft.Json.Linq;
using TrinityAPI.Base;
using TrinityAPI.Base.Tools;
using TrinityAPI.Base.Models;
using Jd.Api.Request;
using Jd.Api;

namespace JingDong.Open.Platform
{
    public class APIRequestHelper
    {
        public static JToken DoRequest(JObject dataset, JToken apiParams, string apiMethod, string eShopCode, string accessToken)
        {
            JObject extendProps = new JObject()
            {
                { "eShopCode", eShopCode },
                { "accessToken", accessToken },
                { "method", apiMethod },
                { "params", apiParams }
            };
            return new APIRequest().Invoke(dataset, new JObject { { "extendProps", extendProps } });
        }
    }
}
